#include "BridgetWindow.h"

#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QTextEdit>
#include <QLineEdit>
#include <QPushButton>
#include "BridgetWindow.h"
#include <QMessageBox>

#include<QScrollArea>

BridgetWindow::BridgetWindow(QWidget *parent, Bridget *bd) :
        QWidget(parent)/*,
        setButton(tr("Save"), this)*/

{
    inputWeight= new QLineEdit(this);
    inputGrowth= new QLineEdit(this);
    inputAge= new QLineEdit(this);
    inputWeight->setText(QString::number(bd->getWeight()));
    inputGrowth->setText(QString::number(bd->getGrowth()));
    inputAge->setText(QString::number(bd->getAge()));
    QVBoxLayout *mainLayout = new QVBoxLayout;
    QLabel *inputWeightL = new QLabel(tr("<H4>Weight, kg:</H4>"), this);
    QLabel *inputGrowthL = new QLabel(tr("<H4>Height, cm:</H4>"), this);
    QLabel *inputAgeL = new QLabel(tr("<H4>Age, year:</H4>"), this);
    QLabel *inputSexL = new QLabel(tr("<H4>Sex:</H4>"), this);
    QLabel *inputActivityL = new QLabel(tr("<H4>Activity:</H4>"), this);
    sex = new QComboBox(this);
    sex->addItem("female");
    sex->addItem("male");

    if (bd->getFemale()==0) sex->setCurrentIndex(1);
    else
        if (bd->getFemale()==1) sex->setCurrentIndex(0);

    activity= new QComboBox(this);
    activity->addItem("lack of sports");
    activity->addItem("rare sports");
    activity->addItem("Work standing");
    activity->addItem("Hard physical work");

    if (bd->getActivity()==1.45 ) activity->setCurrentIndex(0);
    else
        if (bd->getActivity()==1.65 ) activity->setCurrentIndex(1);
    else
        if (bd->getActivity()==1.85 ) activity->setCurrentIndex(2);
    else
        if (bd->getActivity()==2.2 ) activity->setCurrentIndex(3);
    //QHBoxLayout *layout = new QHBoxLayout();
    mainLayout->addWidget(inputWeightL);
    mainLayout->addWidget(inputWeight);
   // mainLayout->addWidget(&addButton);
    mainLayout->addWidget(inputGrowthL);
    mainLayout->addWidget(inputGrowth);
    mainLayout->addWidget(inputAgeL);
    mainLayout->addWidget(inputAge);
    mainLayout->addWidget(inputSexL);
    mainLayout->addWidget(sex);
    mainLayout->addWidget(inputActivityL);
    mainLayout->addWidget(activity);
     mainLayout->addStretch();
    //mainLayout->addWidget(&setButton);




    connect(sex, SIGNAL(activated(int)), bd, SLOT(setFemail(int)));
    connect(activity, SIGNAL(activated(int)), bd, SLOT(setActivity(int)));

   /* connect(&setButton, SIGNAL(clicked()),
            this, SLOT(onSetButtonClicked()));*/
setLayout(mainLayout);
/*QScrollArea *sw = new QScrollArea();
sw->setWidget(this);;
//sw->setWidget(goal);
   //sw->setLayout(stackedLayout);
  //sw->resize(400,400);
  // sw->scroll(100,100);
   sw->setWidgetResizable(true);
   sw->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
  // sw->showMaximized();*/
}



